package cn.smbms.contorller.user;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.log4j.Logger;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import cn.smbms.pojo.User;
import cn.smbms.tools.Constants;

@Controller
@RequestMapping("/log")
public class LogoutController {
	private static Logger logger=Logger.getLogger(LogoutController.class);
	/*
	 * 退出系统方法
	 */
	@RequestMapping("/out")
	public String logout(HttpSession session){
		//清除session
		session.removeAttribute(Constants.USER_SESSION);
		User user=(User)session.getAttribute(Constants.USER_SESSION);
		logger.debug("========================"+user);
		return "login";
	}
	
	/*public boolean yanZhengUser(HttpSession session){
		if(yanZhengUser(session)){
			return "login";
		}
		User user=(User)session.getAttribute(Constants.USER_SESSION);
		System.out.println(user);
		if(user==null){
			return true;
		}
		return false;
	}*/
}
